<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="UTF-8">
<html>
<head>
    <base href="<%=basePath%>">

    <title>新建线索</title>

    <meta name="pragma" content="no-cache">
    <meta name="cache-control" content="no-cache">
    <meta name="expires" content="0">
    <link href="/static/easyui/themes/insdep/easyui.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/easyui_animation.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/easyui_plus.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/insdep_theme_default.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/icon.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/color.css" rel="stylesheet" type="text/css">

    <link href="/static/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">
    <link href="/static/css/common.css" rel="stylesheet" type="text/css">

    <script type="text/javascript" src="/static/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/easyui/themes/insdep/jquery.insdep-extend.min.js"></script>
    <script type="text/javascript" src="/static/ztree/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" src="/static/easyui/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/static/kindeditor/kindeditor-all-min.js"></script>
</head>
<style type="text/css">
    .myselect {
        height: 30px;
    }
</style>

<body style="width:100%;max-width:100%;padding:10px 30px;">
<form id="form" method="post">
    <strong>主要信息</strong>
    <section class="info-section">
        <table id="tb">
            <tr>
                <td class="text-title">线索负责人</td>
                <td class="text-content">
                    <select class="myselect" name="ownerUserId">
                        <option th:each="user:${users}"
                                th:value="${user.id}" th:text="${user.username}"
                        >请选择负责人</option>
                    </select>
                    <button value="放入线索池" id="fang" >放入线索池</button>
                </td>
                <td class="text-title">公司名称</td>
                <td class="text-content">
                    <input type="text" name="name" class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>
            </tr>
            <tr>
                <td class="text-title">来源</td>
                <td class="text-content">
                    <select class="myselect" name="source">
                        <option value="合作伙伴">合作伙伴</option>
                        <option value="广告">广告</option>
                        <option value="营销">营销</option>
                        <option value="朋友介绍">朋友介绍</option>
                    </select>
                </td>
                <td class="text-title">联系人姓名</td>
                <td class="text-content">
                    <input type="text" name="contactsName" class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>
            </tr>
            <tr>
                <td class="text-title">职位</td>
                <td class="text-content">
                    <input type="text" name="position"  class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>

                <td class="text-title">尊称</td>
                <td class="text-content">
                    <select class="myselect" name="saltname">
                        <option value="先生">先生</option>
                        <option value="女士">女士</option>
                    </select>
                </td>
            </tr>

            <tr>
                <td class="text-title">地址</td>
                <td class="text-content" colspan="3">
                    <input type="text" style="width:550px;"  name="address" class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>
            </tr>
            <tr>
                <td class="text-title">手机</td>
                <td class="text-content">
                    <input type="text" name="mobile" class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>
                <td class="text-title">邮箱</td>
                <td class="text-content">
                    <input type="text" name="email" class="easyui-textbox theme-textbox-radius" data-options="required:false">
                </td>
            </tr>
            <tr>
                <td class="text-title">下次联系内容</td>
                <td class="text-content">
                    <input type="text" name="nextstep" class="easyui-textbox theme-textbox-radius" data-options="required:true">
                </td>
                <td class="text-title">下次联系时间</td>
                <td class="text-content">
                    <input class="easyui-datetimebox" name="nextstepTime" data-options="required:false,showSeconds:false" style="width:150px">
                </td>
            </tr>


        </table>

    </section>
    <strong>附加信息</strong>
    <section class="info-section">
        <table>
            <tr>
                <td class="text-title">备注</td>
                <td class="text-content">
                    <textarea name="leadnote" rows="5" style="width:80%;"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;margin-top: 10px;">
                    <a href="javascript:void(0);" id="addBtn" class="easyui-linkbutton button-primary"
                        style="margin-left:-70px;">新建</a>
                </td>
            </tr>
        </table>
    </section>
</form>
<script src="/static/js/jquery.serializejson.min.js"></script>
<script type="text/javascript">
    $(function () {

        $(function () {
            /*放入线索池*/
            $("#fang").click(function (event) {
                event.preventDefault();
                $.ajax({
                    type: "POST",
                    url: '/leads/fang',
                    data: JSON.stringify($("#form").serializeJSON()),
                    dataType: "json",
                    contentType : "application/json",
                    success: function (date) {
                        if(date.d){
                            alert(date.msg)
                        }else {
                            alert(date.msg)
                        }

                    }
                });
            })



            //添加
            $("#addBtn").click(function (event) {
                event.preventDefault();
                $.ajax({
                    type: "POST",
                    url: '/Add',
                    data: JSON.stringify($("#form").serializeJSON()),
                    dataType: "json",
                    contentType : "application/json",
                    success: function (date) {
                        if(date.d){
                            alert(date.msg)
                            parent.parent.$("#topWindow").window("close");
                        }else {
                            alert(date.msg)
                        }
                    }
                });
            })
        });
    });

</script>
</body>
</html>
